function defineLoginForm(){
	hf.widget.LoginForm = Ext.extend(Ext.FormPanel, {
		constructor: function(config) {
			Ext.apply(this, {
				renderTo: 'login_container',
				labelWidth: 100,
				title: labels['login.form.title'],
				width: 300,
				height: 150,
				monitorValid: true,
				frame: true,
				buttonAlign: 'center',
				items:[{
						xtype: 'form-text-field', 
						name:'j_username',
						fieldLabel: labels['login.textfield.label'],  
						blankText: messages['login.textfield.empty.message'], 
						vtypeText: messages['login.textfield.invalid.message'],
						vtype: 'alphanum'
					   },
			       	   {
			       	    xtype: 'form-text-field',
			       	    inputType: 'password',
			       	    name:'j_password',
			       	    fieldLabel: labels['password.textfield.label'],  
		       			blankText: messages['password.textfield.empty.message'], 
		       			vtypeText: messages['password.textfield.invalid.message'],
		       			vtype: 'alphanum'
		       		   },
			       	   {
			       	    xtype: 'checkbox', 
			       	    name: '_spring_security_remember_me',
			       	    fieldLabel: labels['rememberme.checkbox.label']
			       	   }
				],
			    buttons:[{
			    		  xtype: 'form-button',
			    		  ref: '../loginButton',
			    	 	  text: labels['login.button.label'], 
			    		  iconCls: 'icon-login', 
			    		  buttonEvent: 'login', 
			    	 	  formBind: true, 
			    		  tooltip: qtips['qtips.button.login']
			    		 },
			         	 {
			         	  xtype: 'form-button', 
			         	  ref: '../clearButton',
			         	  text: labels['clear.button.label'], 
			         	  iconCls: 'icon-clear', 
			         	  buttonEvent: 'clear', 
			         	  tooltip: qtips['qtips.button.clear']
			         	 },
			             {
			              xtype: 'form-button',
			              ref: '../registrationButton',
			              text: labels['registration.button.label'], 
			              iconCls: 'icon-register', 
			              buttonEvent: 'register', 
			              tooltip: qtips['qtips.button.gotoregister']
			             }
			    ]
			});
			hf.widget.LoginForm.superclass.constructor.apply(this, arguments);
				
			this.on('login', function(button, event){this.processLogin();});
			this.on('clear', function(button, event){this.getForm().reset();});
			this.on('register', function(button, event){new hf.widget.RegistrationWindow().show();});
			         
			this.relayEvents(this.loginButton, ['login']);
			this.relayEvents(this.clearButton, ['clear']);
			this.relayEvents(this.registrationButton, ['register']);
		},
		
		//process user authorization
		processLogin: function(){
			this.getForm().submit({
       			url: 'j_spring_security_check',
				method:'POST', 
				success:function(form, action){
					window.location = 'init.action';
				},
				failure:function(form, action){
					if(action.failureType == Ext.form.Action.SERVER_INVALID){
						Ext.Msg.alert(labels['failure.alert.title'], messages['message.error.server.invalid']);
					//}else if (action.failureType == Ext.form.Action.CONNECT_FAILURE){
						//Ext.Msg.alert(labels['failure.alert.title'], messages['message.error.connect.failure']);
					}else{
						form.reset();
						Ext.Msg.alert(labels['failure.alert.title'], messages['login.failure.alert.message1']);
					}	
				} 
			});
		}
	});
};